package com.chujian.Activities;

import java.text.SimpleDateFormat;
import java.util.Date;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.chujian.Utils.JsonUtil;
import com.chujian.model.Book;
import com.chujian.orderingsystem.R;

public class BookConfirmActivity extends Activity{
	private TextView mTvUser;
	private TextView mTvArriveTime;
	private TextView mTvTable;
	private TextView mTvBookId;
	private Button mBtnComfirm;
	private Button mBtnRefuse;
	private Book mBook;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.book_confirm_seller);
		initView();
		Intent intent=getIntent();
		String jsonString=intent.getStringExtra("book");
		mBook=JsonUtil.BookFromJson(jsonString);
		if(mBook!=null){
			SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm");
			String arriveTime=df.format(new Date(mBook.getArriveTime()));
			mTvUser.setText(mBook.getUserPhone());
			mTvArriveTime.setText(arriveTime);
			mTvTable.setText(mBook.getTableName());
			mTvBookId.setText(mBook.getBookId()+"");
		}
		
	}
	
	private void initView() {
		// TODO Auto-generated method stub
		mTvUser=(TextView) findViewById(R.id.tv_book_list_s_user_phone);
		mTvArriveTime=(TextView) findViewById(R.id.tv_book_list_s_arrive_time);
		mTvTable=(TextView) findViewById(R.id.tv_book_list_s_table_name);
		mTvBookId=(TextView) findViewById(R.id.tv_book_list_s_book_id);
		mBtnComfirm=(Button) findViewById(R.id.btn_book_c_s_confirm);
		mBtnRefuse=(Button) findViewById(R.id.btn_book_c_s_refuse);
		
	}

	public void doClick(View v){
		switch (v.getId()) {
		case R.id.btn_book_c_s_refuse:
			
			break;
		case R.id.btn_book_c_s_confirm:
			
			break;

		default:
			break;
		}
		
	}
	public void IbBack(View v){
		BookConfirmActivity.this.finish();
	}
}
